package vn.hut.soict.cs.phanquanghuy.neslegend.emulator.cpu;

public class Instruction {
	 //OPCODE FOR ADC INSTRUCTION
    public static final int OPCODE_ADC_IMMEDIATE = 0x69;
    public static final int OPCODE_ADC_ZERO_PAGE = 0x65;
    public static final int OPCODE_ADC_ZERO_PAGE_X = 0x75;
    public static final int OPCODE_ADC_ABSOLUTE = 0x6d;
    public static final int OPCODE_ADC_ABSOLUTE_X = 0x7d;
    public static final int OPCODE_ADC_ABSOLUTE_Y = 0x79;
    public static final int OPCODE_ADC_INDIRECT_X = 0x61;
    public static final int OPCODE_ADC_INDIRECT_Y = 0x71;

    //OPCODE FOR AND INSTRUCTION
    public static final int OPCODE_AND_IMMEDIATE = 0x29;
    public static final int OPCODE_AND_ZERO_PAGE = 0x25;
    public static final int OPCODE_AND_ZERO_PAGE_X = 0x35;
    public static final int OPCODE_AND_ABSOLUTE = 0x2d;
    public static final int OPCODE_AND_ABSOLUTE_X = 0x3d;
    public static final int OPCODE_AND_ABSOLUTE_Y = 0x39;
    public static final int OPCODE_AND_INDIRECT_X = 0x21;
    public static final int OPCODE_AND_INDIRECT_Y = 0x31;

    //OPCODE FOR ASL INSTRUCTION
    public static final int OPCODE_ASL_ACCUMULATOR = 0x0a;
    public static final int OPCODE_ASL_ZERO_PAGE = 0x06;
    public static final int OPCODE_ASL_ZERO_PAGE_X = 0x16;
    public static final int OPCODE_ASL_ABSOLUTE = 0x0e;
    public static final int OPCODE_ASL_ABSOLUTE_X = 0x1e;

    //OPCODE FOR BIT INSTRUCTION
    public static final int OPCODE_BIT_ZERO_PAGE = 0x24;
    public static final int OPCODE_BIT_ABSOLUTE = 0x2C;

    //OPCODE FOR BRANCH INSTRUCTION SET

    /*Branch on PLus*/
    public static final int OPCODE_BPL = 0x10;
    /*Branch on MInus*/
    public static final int OPCODE_BMI = 0x30;
    /*Branch on oVerflow Clear*/
    public static final int OPCODE_BVC = 0x50;
    /*Branch on oVerflow Set*/
    public static final int OPCODE_BVS = 0x70;
    /*Branch on Carry Clear*/
    public static final int OPCODE_BCC = 0x90;
    /*Branch on Carry Set*/
    public static final int OPCODE_BCS = 0xb0;
    /*Branch on Not Equal*/
    public static final int OPCODE_BNE = 0xd0;
    /*Brach on EQual*/
    public static final int OPCODE_BEQ = 0xf0;
    
    //
    public static final int OPCODE_BRK = 0x00;
    
    //OPCODE FOR CLEAR FLAG INSTRUCTION
    public static final int OPCODE_CLC = 0x18;
    public static final int OPCODE_CLD = 0xd8;
    public static final int OPCODE_CLI = 0x58;
    public static final int OPCODE_CLV = 0xb8;
    
    //OPCODE FOR COMPARE INSTRUCTION
    public static final int OPCODE_CMP_IMMEDIATE = 0xc9;
    public static final int OPCODE_CMP_ZERO_PAGE = 0xc5;
    public static final int OPCODE_CMP_ZERO_PAGE_X = 0xd5;
    public static final int OPCODE_CMP_ABSOLUTE = 0xcd;
    public static final int OPCODE_CMP_ABSOLUTE_X = 0xdd;
    public static final int OPCODE_CMP_ABSOLUTE_Y = 0xd9;
    public static final int OPCODE_CMP_INDIRECT_X = 0xc1;
    public static final int OPCODE_CMP_INDIRECT_Y = 0xd1;
    
    //OPCODE FOR COMPARE X REGISTER
    public static final int OPCODE_CPX_IMMEDIATE = 0xe0;
    public static final int OPCODE_CPX_ZERO_PAGE = 0xe4;
    public static final int OPCODE_CPX_ABSOLUTE = 0xec;
    
    //OPCODE FOR COMPARE Y REGISTER
    public static final int OPCODE_CPY_IMMEDIATE = 0xc0; 
    public static final int OPCODE_CPY_ZERO_PAGE = 0xc4; 
    public static final int OPCODE_CPY_ABSOLUTE = 0xcc;
    
    //OPCODE FOR DECREMENT/INCREMENT MEMORY
    public static final int OPCODE_DEC_ZERO_PAGE = 0xc6; 
    public static final int OPCODE_DEC_ZERO_PAGE_X = 0xd6; 
    public static final int OPCODE_DEC_ABSOLUTE = 0xce; 
    public static final int OPCODE_DEC_ABSOLUTE_X = 0xde;
    
    public static final int OPCODE_INC_ZERO_PAGE = 0xe6; 
    public static final int OPCODE_INC_ZERO_PAGE_X = 0xf6; 
    public static final int OPCODE_INC_ABSOLUTE = 0xee; 
    public static final int OPCODE_INC_ABSOLUTE_X = 0xfe;
    
    //OPCODE FOR DECREMENT/INCREMENT INDEX REGISTER
    public static final int OPCODE_DEX = 0xca;
    public static final int OPCODE_DEY = 0x88;
    
    public static final int OPCODE_INX = 0xe8;
    public static final int OPCODE_INY = 0xc8;
    
    //OPCODE FOR XOR
    public static final int OPCODE_EOR_IMMEDIATE = 0x49; 
    public static final int OPCODE_EOR_ZERO_PAGE = 0x45; 
    public static final int OPCODE_EOR_ZERO_PAGE_X = 0x55; 
    public static final int OPCODE_EOR_ABSOLUTE = 0x4d; 
    public static final int OPCODE_EOR_ABSOLUTE_X = 0x5d; 
    public static final int OPCODE_EOR_ABSOULTE_Y = 0x59; 
    public static final int OPCODE_EOR_INDIRECT_X = 0x41; 
    public static final int OPCODE_EOR_INDIRECT_Y = 0x51;
    
    //
    public static final int OPCODE_JMP_ABSOULUTE = 0x4c; 
    public static final int OPCODE_JMP_INDIRECT = 0x6c;
    
    public static final int OPCODE_JSR = 0x20;
    
    //LOAD MEMORY TO REGISTER
    public static final int OPCODE_LDA_IMMEDIATE = 0xa9;
    public static final int OPCODE_LDA_ZERO_PAGE = 0xa5;
    public static final int OPCODE_LDA_ZERO_PAGE_X = 0xb5;
    public static final int OPCODE_LDA_ABSOLUTE = 0xad;
    public static final int OPCODE_LDA_ABSOLUTE_X = 0xbd;
    public static final int OPCODE_LDA_ABSOLUTE_Y = 0xb9;
    public static final int OPCODE_LDA_INDIRECT_X = 0xa1;
    public static final int OPCODE_LDA_INDIRECT_Y = 0xb1;
    
    public static final int OPCODE_LDX_IMMEDIATE = 0xa2;
    public static final int OPCODE_LDX_ZERO_PAGE = 0xa6;
    public static final int OPCODE_LDX_ZERO_PAGE_Y = 0xb6;
    public static final int OPCODE_LDX_ABSOLUTE = 0xae;
    public static final int OPCODE_LDX_ABSOLUTE_Y = 0xbe;
    
    public static final int OPCODE_LDY_IMMEDIATE = 0xa0;
    public static final int OPCODE_LDY_ZERO_PAGE = 0xa4;
    public static final int OPCODE_LDY_ZERO_PAGE_X = 0xb4;
    public static final int OPCODE_LDY_ABSOLUTE = 0xac;
    public static final int OPCODE_LDY_ABSOLUTE_X = 0xbc;
    
    //
    public static final int OPCODE_LSR_ACCUMULATOR = 0x4a; 
    public static final int OPCODE_LSR_ZERO_PAGE = 0x46; 
    public static final int OPCODE_LSR_ZERO_PAGE_X = 0x56; 
    public static final int OPCODE_LSR_ABSOLUTE = 0x4e; 
    public static final int OPCODE_LSR_ABSOLUTE_X = 0x5e;
    
    //
    public static final int OPCODE_NOP = 0xea;
    
    //
    public static final int OPCODE_ORA_IMMEDIATE = 0x09; 
    public static final int OPCODE_ORA_ZERO_PAGE = 0x05; 
    public static final int OPCODE_ORA_ZERO_PAGE_X = 0x15; 
    public static final int OPCODE_ORA_ABSOLUTE = 0x0d; 
    public static final int OPCODE_ORA_ABSOLUTE_X = 0x1d; 
    public static final int OPCODE_ORA_ABSOLUTE_Y = 0x19; 
    public static final int OPCODE_ORA_INDIRECT_X = 0x01; 
    public static final int OPCODE_ORA_INDIRECT_Y = 0x11;
    
    //PUSH REGISTER TO STACK
    public static final int OPCODE_PHA = 0x48;
    public static final int OPCODE_PHP = 0x08;
    
    //PULL STACK TO REGISTER
    public static final int OPCODE_PLA = 0x68;
    public static final int OPCODE_PLP = 0x28;
    
    //
    public static final int OPCODE_ROL_ACCUMULATOR = 0x2a;
    public static final int OPCODE_ROL_ZERO_PAGE = 0x26;
    public static final int OPCODE_ROL_ZERO_PAGE_X = 0x36;
    public static final int OPCODE_ROL_ABSOLUTE = 0x2E;
    public static final int OPCODE_ROL_ABSOLUTE_X = 0x3e;
    
    //
    public static final int OPCODE_ROR_ACCUMULATOR = 0x6a;
    public static final int OPCODE_ROR_ZERO_PAGE = 0x66;
    public static final int OPCODE_ROR_ZERO_PAGE_X = 0x76;
    public static final int OPCODE_ROR_ABSOLUTE = 0x6e;
    public static final int OPCODE_ROR_ABSOLUTE_X = 0x7e;
    
    //
    public static final int OPCODE_RTI = 0x40;
    
    //
    public static final int OPCODE_RTS = 0x60;
    
    //
    public static final int OPCODE_SBC_IMMEDIATE = 0xe9;
    public static final int OPCODE_SBC_ZERO_PAGE = 0xe5;
    public static final int OPCODE_SBC_ZERO_PAGE_X = 0xf5;
    public static final int OPCODE_SBC_ABSOLUTE = 0xed;
    public static final int OPCODE_SBC_ABSOLUTE_X = 0xfd;
    public static final int OPCODE_SBC_ABSOLUTE_Y = 0xf9;
    public static final int OPCODE_SBC_INDIRECT_X = 0xe1;
    public static final int OPCODE_SBC_INDIRECT_Y = 0xf1;
    
    //
    public static final int OPCODE_SEC = 0x38;
    public static final int OPCODE_SED = 0xf8;
    public static final int OPCODE_SEI = 0x78;
    
    //
    public static final int OPCODE_STA_ZERO_PAGE = 0x85;
    public static final int OPCODE_STA_ZERO_PAGE_X = 0x95;
    public static final int OPCODE_STA_ABSOLUTE = 0x8d;
    public static final int OPCODE_STA_ABSOLUTE_X = 0x9d;
    public static final int OPCODE_STA_ABSOLUTE_Y = 0x99;
    public static final int OPCODE_STA_INDIRECT_X = 0x81;
    public static final int OPCODE_STA_INDIRECT_Y = 0x91;
    
    public static final int OPCODE_STX_ZERO_PAGE = 0x86;
    public static final int OPCODE_STX_ZERO_PAGE_Y = 0x96;
    public static final int OPCODE_STX_ABSOLUTE = 0x8e;
    
    public static final int OPCODE_STY_ZERO_PAGE = 0x84;
    public static final int OPCODE_STY_ZERO_PAGE_X = 0x94;
    public static final int OPCODE_STY_ABSOLUTE = 0x8c;
    
    //TRANSFER
    public static final int OPCODE_TAX = 0xaa;
    public static final int OPCODE_TAY = 0xa8;
    public static final int OPCODE_TSX = 0xba;
    public static final int OPCODE_TXA = 0x8a;
    public static final int OPCODE_TXS = 0x9a;
    public static final int OPCODE_TYA = 0x98;
    
}
